<% content_for :sidebar do %>
  <h1>Listing Tasks</h1>
<% end %>

<table id="tasks_table" class="datatable table table-striped table-bordered">
  <caption><h3><%= "Tasks" %></h3></caption>
  <thead>
    <tr>
      <th>Event</th>
      <th>Title</th>
      <th>Priority</th>
      <th>Description</th>
      <th>Location</th>
      <th>Status</th>
      <th>Requirements Met</th>
      <th>Start Time</th>
      <th>End Time</th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <% @tasks.each do |task| %>
      <tr <%== task_status_class(task) %>>
        <td><%= link_to task.event.title, task.event %></td>
        <td><%= link_to task.title, task %></td>
        <td <%== sorting_order(task.priority) %>><%= task_priority_label(task) %></td>
        <td><%= truncate(task.description) %></td>
        <td><%= truncate(task.location) %></td>
        <td <%== sorting_order(task.staffing_value) %>><%= task_staffing_label(task) %></td>
        <td><%= task.requirements_met_count %>/<%= task.requirements_count %></td>
        <td><%= task.start_time %></td>
        <td><%= task.end_time %></td>
        <td><%= table_button_link 'Edit', edit_task_path(task) if can? :edit, task %></td>
      </tr>
    <% end %>
  </tbody>
</table>
